#ifndef PROTOCOL_H
#define PROTOCOL_H

#include <ace/SOCK_Stream.h>
#include <ace/CDR_Stream.h>
#include <QString>
#include <memory>
#include <ace/Log_Msg.h>

#include "common.h"

class ProtoSrv
{
public:
    ProtoSrv(ProtocolType pt = PT_NULL) : _type(pt){}
    virtual ~ProtoSrv() {}

    void                        setProtocolType(ProtocolType pt) { _type = pt;}
    ProtocolType                getProtocolType() const {return _type;}

    virtual bool                encode(ACE_OutputCDR &) {return true;}
    virtual ProtoSrv*           decode(ACE_InputCDR &) = 0;
    virtual ProtoSrv*           execute(ACE_SOCK_Stream &) {return 0;}
private:
    ProtocolType _type;
};


#endif // PROTOCOL_H
